Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
zero-downtime-upgrade: upgrade a stateful app by starting a second CVM of the same app on the new compose and handing state to it, instead of rebooting the CVM in place.upgrade.shreplicates the CVM withDORMANT=1(forward-only), runsphala deploy --cvm-idon the replica alone with the new compose, waits for it to take the writer role, then deletes the old CVM.begin,commit); state is AES-GCM encrypted under aGetKeykey, which both CVMs derive because they share the app id.Measured on Phala Cloud (prod7,
tdx.small) with a no-retry client: an in-placephala deploy --cvm-idfailed 13 requests over ~65 s; two consecutiveupgrade.shruns failed 0 of 334, and a rerun of the simplified server 0 of 169. Forwarding through the retired CVM adds about 10 ms per request during the overlap.Note for reviewers: the replica inherits
allowed_envs, so the first deploy must namePREDECESSOR_URLandDORMANT(empty values are fine). Without that the replica boots as a second writer;upgrade.shchecks for it.Also bump
APP_VERSIONwith every code change: Compose doesn't recreate a container when only inline config content changes, so a code-only update keeps running the old code.node zero-downtime-upgrade/test-local.mjsruns the protocol locally with a fake dstack socket.